package com.cm.caseManagement.service.impl;

import com.cm.caseManagement.dao.CmAdvanceCostMapper;
import com.cm.caseManagement.pojo.entity.CmAdvanceCost;
import com.cm.caseManagement.service.ICmAdvanceCostService;
import com.cm.caseManagement.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 代收代付Service业务层处理
 *
 * @author ruoyi
 * @date 2025-10-05
 */
@Service
public class CmAdvanceCostServiceImpl implements ICmAdvanceCostService
{
    @Autowired
    private CmAdvanceCostMapper cmAdvanceCostMapper;

    /**
     * 查询代收代付
     *
     * @param id 代收代付主键
     * @return 代收代付
     */
    @Override
    public CmAdvanceCost selectCmAdvanceCostById(Long id)
    {
        return cmAdvanceCostMapper.selectCmAdvanceCostById(id);
    }

    /**
     * 查询代收代付列表
     *
     * @param cmAdvanceCost 代收代付
     * @return 代收代付
     */
    @Override
    public List<CmAdvanceCost> selectCmAdvanceCostList(CmAdvanceCost cmAdvanceCost)
    {
        return cmAdvanceCostMapper.selectCmAdvanceCostList(cmAdvanceCost);
    }

    /**
     * 新增代收代付
     *
     * @param cmAdvanceCost 代收代付
     * @return 结果
     */
    @Override
    public int insertCmAdvanceCost(CmAdvanceCost cmAdvanceCost)
    {
        cmAdvanceCost.setCreateTime(DateUtils.getNowDate());
        return cmAdvanceCostMapper.insertCmAdvanceCost(cmAdvanceCost);
    }

    /**
     * 修改代收代付
     *
     * @param cmAdvanceCost 代收代付
     * @return 结果
     */
    @Override
    public int updateCmAdvanceCost(CmAdvanceCost cmAdvanceCost)
    {
        cmAdvanceCost.setUpdateTime(DateUtils.getNowDate());
        return cmAdvanceCostMapper.updateCmAdvanceCost(cmAdvanceCost);
    }

    /**
     * 批量删除代收代付
     *
     * @param ids 需要删除的代收代付主键
     * @return 结果
     */
    @Override
    public int deleteCmAdvanceCostByIds(Long[] ids)
    {
        return cmAdvanceCostMapper.deleteCmAdvanceCostByIds(ids);
    }

    /**
     * 删除代收代付信息
     *
     * @param id 代收代付主键
     * @return 结果
     */
    @Override
    public int deleteCmAdvanceCostById(Long id)
    {
        return cmAdvanceCostMapper.deleteCmAdvanceCostById(id);
    }
}
